{extend name="./template/default/m/pub/base2.html" /}
{block name="seo"}
<title>{$book.book_name}小说全文在线免费阅读-{$book.author_name}-{$site_name}</title>
<meta name="description" content="{$book.book_name}是一本{$book.cate.cate_name}小说，主角是{$book.role_name}，小说简介：{$book.summary}">
{/block}
{block name="main"}
<div class="x-page__content">
    <div class="x-book__detail">
        <div class="x-detail__top">
            <div class="x-detail__book">
                <div class="bg-blur" style="background: url('{$book.cover_url}') center top / cover no-repeat;"></div>
                <div class="bg-blur__bg"></div>
                <div class="x-book">
                    <div class="x-book__multi">
                        <div class="x-book__coverbox">
                            <img lazy="loaded" class="x-book__cover"src="{$book.cover_url}" style="width: 1.5rem; height: 2rem;">
                        </div>
                        <div class="x-book__text--multi" style="width: calc(100% - 1.5rem); height: 2rem;">
                            <div class="x-detail__book--info">
                                <p class="x-detail__info--title">{$book.book_name}</p>
                                <p class="x-detail__info--author">{$book.author_name}</p>
                                <p class="x-detail__info--words">字数：{$book.words}万字</p>
                                <p class="x-detail__info--reads">
                                    阅读：{$clicks}
                                    <span>{$book.end == 2 ? '连载中' : '已完结'}</span>
                                </p>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="x-detail__operator">
                    <span class="x-detail__operator--item" id="addshelf">加入书架</span>
                    {if $start > -1}
                    <span class="to-read" onclick="javascript:location.href='/{$chapter_ctrl}/{$start}';">开始阅读</span>
                    {else /}
                    <span class="to-read">开始阅读</span>
                    {/if}
                </div>
            </div>
            <div class="x-detail__ticket">
                <div class="x-detail__ticket--box">
                <span  class="x-detail__ticket--item van-hairline--right">
                    0 <i>顶</i>
                </span>
                    <span class="x-detail__ticket--item van-hairline--right">
                    0 <i>踩</i>
                </span>
                    <span class="x-detail__ticket--item">
                    0票 <i>推荐票</i>
                </span>
                </div>
            </div>
        </div>

        <div class="x-detail__intro hr-bottom">
            <div class="x-detail__intro--content">
                {$book.summary}
            </div>
            <div class="x-detail__intro--tags">
                <span></span>
            </div>
        </div>
        <div class="x-city__part x-detail__part hr-bottom">
            <div class="x-part__title">
                目录
                <span class="x-catalog__total"></span>
                <span class="x-catalog__update">更新于：{$book.last_time|date='Y-m-d'}</span>
            </div>
            <div class="x-part__content">
                <a href="/{$chapter_ctrl}/{$book.last_chapter_id}">
                    <div class="x-catalog__new">
                        {$book.last_chapter}
                        <span>最新</span>
                    </div>
                </a>
                <div class="x-catalog__list van-hairline--bottom">
                    {volist name="book.chapters" id="vo" length="3"}
                    <a href="/{$chapter_ctrl}/{$vo.id}">
                        <p class="x-catalog__list--item">{$vo.chapter_name}</p>
                    </a>
                    {/volist}
                </div>
                <div class="x-catalog__more">更多目录&gt;</div>
            </div>
        </div>

        <div class="chapter-list">
            <div class="x-page__header van-hairline--bottom">
                <a href="javascript:" id="chapter_back"></a>
                <span class="x-page__title">目录</span>
            </div>
            <div class="x-page__content">
                <div class="x-catalog">
                    <div class="van-pull-refresh">
                        <div id="wrapper" class="van-pull-refresh__track">
                            <div class="x-catalog__list van-list">
                                {volist name="book.chapters" id="vo"}
                                <a href="/{$chapter_ctrl}/{$vo.id}">
                                    <p class="x-catalog__item">{$vo.chapter_name}</p>
                                </a>
                                {/volist}
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="x-city__part x-detail__part hr-bottom">
            <div class="x-part__content">
                {include file="./template/default/m/books/comment.html"}
            </div>
        </div>
        <div class="x-city__part x-detail__part hr-bottom">
            <div class="x-part__title">同类作品</div>
            <div class="x-part__content">
                <div class="x-detail__part--book">
                    {volist name="recommand" id="vo" length="10"}
                    <div class="x-book" style="width: 2rem;">
                        <a href="/{$book_ctrl}/{$vo.param}" title="{$vo.book_name}">
                            <div class="x-book__coverbox">
                                <img lazy="loaded" class="x-book__cover" src="{$vo.cover_url}" style="width: 2rem; height: 2.66667rem;">
                            </div>
                            <div class="x-book__text--normal">{$vo.book_name}</div>
                        </a>
                    </div>
                    {/volist}
                </div>
            </div>
        </div>
    </div>
</div>
{/block}
{block name="js"}
<script>
    $('#addshelf').click(function () {
        $.post({
            url:`/addfavor`,
            data:{'book_id' : {$book.id}},
            success: function (res) {
                if (res.err == 1) {
                    layer.msg(res.msg,{icon: 0,shade: 0.3})
                } else {
                    layer.msg(res.msg,{icon: 1,shade: 0.3})
                }

            },
            error: function (data) {
                layer.msg(data,{icon: 0,shade: 0.3})
            }
        })
    })
</script>
{/block}